﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CfgTeam.ascx.cs" Inherits="Lenovo.CFI.Web.VP.CfgTeam" %>
<tbwc:StyleSheetControl ID="SscList" runat="server" CssPath="list.css"></tbwc:StyleSheetControl>
<tbwc:StyleSheetControl ID="SccDialogs" runat="server" CssPath="modaldialogs.css"></tbwc:StyleSheetControl>
<tbwc:StyleSheetControl ID="SscLink" runat="server" CssPath="VP/cfg/cfgteam.css"></tbwc:StyleSheetControl>
<ajaxToolkit:ToolkitScriptManager runat="Server" EnablePartialRendering="true" CombineScripts="false" ID="ScriptManager1" />
<asp:UpdateProgress ID="UpProgress" runat="server" DisplayAfter="1">
    <ProgressTemplate>
        <div class="ajaxwait">waiting...</div>
    </ProgressTemplate>
</asp:UpdateProgress>
<table id="teamMgt">
    <tr>
        <td id="teamList"><!-- Team List -->
            <asp:UpdatePanel ID="UpTeamList" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Repeater ID="RepTeam" runat="server" onitemcommand="RepTeam_ItemCommand" 
                        onitemdatabound="RepTeam_ItemDataBound">
                        <HeaderTemplate><ul></HeaderTemplate>
                        <ItemTemplate><li><asp:LinkButton ID="BtnTeam" runat="server" CommandName="OpenEdit"
                            CommandArgument='<%# Eval("ID")%>'>Team</asp:LinkButton></li></ItemTemplate>
                        <FooterTemplate></ul></FooterTemplate>
                    </asp:Repeater>
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
        <td id="teamInfo"><!-- Team 信息 -->
            <asp:UpdatePanel ID="UpDetail" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <tbwc:Fieldset ID="FsEdit" runat="server" DesignWidth="700px" CssClass="editArea" GroupingText="Team Info" DefaultButton="BtnSave">
                    <div><asp:Label ID="LblTitleEdit" runat="server" AssociatedControlID="TxtTitleEdit" Text="Title:" CssClass="title"></asp:Label><asp:TextBox
                        ID="TxtTitleEdit" runat="server" MaxLength="20" Width="20em"></asp:TextBox><span class="hint"><asp:RequiredFieldValidator
                        ID="RfvTitleEdit" runat="server" ControlToValidate="TxtTitleEdit" ErrorMessage="Required" Display="Dynamic" ValidationGroup="EditTeam"></asp:RequiredFieldValidator></span></div>
                    <div><asp:Label ID="LblManagerEdit" runat="server" AssociatedControlID="DdlManagerEdit" Text="Manager:" CssClass="title"></asp:Label><asp:DropDownList
                        ID="DdlManagerEdit" runat="server"></asp:DropDownList></div>
                    <div><asp:Label ID="LblVPEdit" runat="server" AssociatedControlID="DdlVPEdit" Text="VP:" CssClass="title"></asp:Label><asp:DropDownList
                        ID="DdlVPEdit" runat="server"></asp:DropDownList></div>
                    <div><asp:Label ID="LblGddlEdit" runat="server" AssociatedControlID="CbGddlEdit" Text="GDDL:" CssClass="title"></asp:Label><asp:CheckBox
                        ID="CbGddlEdit" runat="server" /></div>
                    <div><asp:Label ID="LblEnabledEdit" runat="server" AssociatedControlID="CbEnabledEdit" Text="Enabled:" CssClass="title"></asp:Label><asp:CheckBox
                        ID="CbEnabledEdit" runat="server" /></div>
                
                    <div class="operation team"><asp:Button ID="BtnSave" runat="server" SkinID="EditPrimary" Text="Save" ToolTip="Save" 
                        OnClick="BtnSave_Click" ValidationGroup="EditOrgan" /><asp:LinkButton ID="BtnAddTeam" SkinID="EditSecondary" ToolTip="Add Team"
                            runat="server">Add Team</asp:LinkButton></div>
                
                    <ajaxToolKit:ModalPopupExtender ID="MpeAddTeam" runat="server" TargetControlID="BtnAddTeam" 
                        PopupControlID="PnlAddTeam" CancelControlID="BtnAddTeamCancel" 
                        BackgroundCssClass="modalBackground" PopupDragHandleControlID="PnlAddTeamCaption" Drag="false">
                    </ajaxToolKit:ModalPopupExtender>
                    <asp:Panel ID="PnlAddTeam" runat="server" CssClass="modalBox detail" Style="display: none;" Width="380px">
                        <asp:Panel ID="PnlAddTeamCaption" runat="server" CssClass="caption" Style="margin-bottom: 10px; cursor: hand;">
		                    Add Team</asp:Panel>
	                    <div><asp:Label ID="LblTitleAdd" runat="server" AssociatedControlID="LblTitleAdd" Text="Title:" CssClass="title"></asp:Label><asp:TextBox
                            ID="TxtTitleAdd" runat="server" MaxLength="20" Width="20em"></asp:TextBox><span class="hint"><asp:RequiredFieldValidator
                            ID="RfvTitleAdd" runat="server" ControlToValidate="TxtTitleAdd" ErrorMessage="Required" Display="Dynamic" ValidationGroup="AddTeam"></asp:RequiredFieldValidator></span></div>
                        <div><asp:Label ID="LblManagerAdd" runat="server" AssociatedControlID="DdlManagerAdd" Text="Manager:" CssClass="title"></asp:Label><asp:DropDownList
                            ID="DdlManagerAdd" runat="server"></asp:DropDownList></div>
                        <div><asp:Label ID="LblVPAdd" runat="server" AssociatedControlID="DdlVPAdd" Text="VP:" CssClass="title"></asp:Label><asp:DropDownList
                            ID="DdlVPAdd" runat="server"></asp:DropDownList></div>
                        <div><asp:Label ID="LblGddlAdd" runat="server" AssociatedControlID="CbGddlAdd" Text="GDDL:" CssClass="title"></asp:Label><asp:CheckBox
                            ID="CbGddlAdd" runat="server" /></div>
                        <div style="white-space: nowrap; text-align: center; margin-top:2em;">
		                    <asp:Button ID="BtnAddTeamSave" runat="server" Text="Save" OnClick="BtnAddTeamSave_Click" CausesValidation="true" ValidationGroup="AddTeam"/>
		                    <asp:Button ID="BtnAddTeamCancel" runat="server" CausesValidation="false" Text="Cancel"/>
	                    </div>
                </asp:Panel>
                </tbwc:Fieldset>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="RepTeam" EventName="ItemCommand" />
            </Triggers>
            </asp:UpdatePanel>
        
            <asp:UpdatePanel ID="UpUser" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <tbwc:Fieldset ID="FsUser" runat="server" DesignWidth="700px" CssClass="editArea" GroupingText="User">
                    <div class="operation user">
                            <span class="op">ItCode:<asp:TextBox ID="TxtItCode" runat="server" Width="8em" 
                                AutoPostBack="true" ontextchanged="TxtItCode_TextChanged" ToolTip="Input itcode to find user"></asp:TextBox></span>
                    </div>

                    <div class="dataListArea">
                        <tbwc:GridViewEx ID="GvUser" runat="server" DataKeyNames="ItCode" 
                            OnRowDataBound="GvUser_RowDataBound" AllowPaging="false" 
                            onrowcommand="GvUser_RowCommand" >
                            <Columns>
                                <asp:TemplateField HeaderText="No.">
                                    <itemstyle cssclass="listNo" />
                                    <itemtemplate><asp:Literal ID="LtrNo" runat="server"></asp:Literal></itemtemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ItCode">
                                    <itemstyle cssclass="itCode" />
                                    <itemtemplate><%# Eval("ItCode")%></itemtemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Name">
                                    <itemstyle cssclass="realName" />
                                    <itemtemplate><%# Eval("RealName")%></itemtemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Phone">
                                    <itemstyle cssclass="phone" />
                                    <itemtemplate><%# Eval("Phone")%></itemtemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Level">
                                    <itemstyle cssclass="level" />
                                    <itemtemplate><%# Eval("PermLevel")%></itemtemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="&#160;">
                                    <itemstyle cssclass="listOp" />
                                    <itemtemplate><asp:ImageButton 
                                        ID="BtnEdit" runat="server" CausesValidation="False" CommandName="OpenEdit"
                                            SkinID="ListEdit" CommandArgument='<%# Eval("ItCode")%>' />
                                    </itemtemplate>
                                </asp:TemplateField>
                            </Columns>
                        </tbwc:GridViewEx>
                    </div>

                    <asp:Button ID="BtnHiddenEdit" runat="Server" Style="display:none" />
                    <ajaxToolKit:ModalPopupExtender ID="MpeEditUser" runat="server" TargetControlID="BtnHiddenEdit" 
                        PopupControlID="PnlEditUser" CancelControlID="BtnEditUserCancel" 
                        BackgroundCssClass="modalBackground" PopupDragHandleControlID="PnlEditUserCaption" Drag="false">
                    </ajaxToolKit:ModalPopupExtender>
                    <asp:Panel ID="PnlEditUser" runat="server" CssClass="modalBox detail" Style="display: none;" Width="480px">
                        <asp:Panel ID="PnlEditUserCaption" runat="server" CssClass="caption" Style="margin-bottom: 10px; cursor: hand;">
		                    Edit User</asp:Panel>
	                    <div><asp:Label ID="LblItCodeEditUser" runat="server" AssociatedControlID="TxtItCodeEditUser" Text="ItCode:" CssClass="title"></asp:Label><asp:TextBox
                                ID="TxtItCodeEditUser" runat="server" MaxLength="20" Width="20em" ReadOnly="true"></asp:TextBox></div>
	                    <div><asp:Label ID="LblRealNameEditUser" runat="server" AssociatedControlID="TxtRealNameEditUser" Text="RealName:" CssClass="title"></asp:Label><asp:TextBox
                                ID="TxtRealNameEditUser" runat="server" MaxLength="10" Width="4em" ReadOnly="true"></asp:TextBox><span class="hint"><asp:RequiredFieldValidator
                                ID="RfvRealNameEditUser" runat="server" ControlToValidate="TxtRealNameEditUser" ErrorMessage="Required" Display="Dynamic" ValidationGroup="EditUser"></asp:RequiredFieldValidator></span></div>
	                    <div><asp:Label ID="LblPhoneEditUser" runat="server" AssociatedControlID="TxtPhoneEditUser" Text="Phone:" CssClass="title"></asp:Label><asp:TextBox
                                ID="TxtPhoneEditUser" runat="server" MaxLength="20" Width="20em" ReadOnly="true"></asp:TextBox><span class="hint"><asp:RequiredFieldValidator
                                ID="RfvPhoneEditUser" runat="server" ControlToValidate="TxtPhoneEditUser" ErrorMessage="Required" Display="Dynamic" ValidationGroup="EditUser"></asp:RequiredFieldValidator></span></div>
                        <div><asp:Label ID="LblTeamEditUser" runat="server" AssociatedControlID="DdlTeamEditUser" Text="Team:" CssClass="title"></asp:Label><asp:DropDownList
                                ID="DdlTeamEditUser" runat="server" Width="20.5em"></asp:DropDownList></div>
                        <div><asp:Label ID="LblLevelEditUser" runat="server" AssociatedControlID="DdlLevelEditUser" Text="Level:" CssClass="title"></asp:Label><asp:DropDownList
                                ID="DdlLevelEditUser" runat="server" Width="20.5em">
                                    <asp:ListItem Text="1" Value="1"></asp:ListItem>
                                    <asp:ListItem Text="2" Value="2"></asp:ListItem>
                                    <asp:ListItem Text="3" Value="3"></asp:ListItem>
                                </asp:DropDownList></div>
                        <div><asp:Label ID="LblRolesEditUser" runat="server" AssociatedControlID="CbRolesEditUser" Text="Roles:" CssClass="title"></asp:Label><asp:CheckBoxList
                                ID="CbRolesEditUser" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                                    <asp:ListItem Text="Admin" Value="1"></asp:ListItem>
                                    <asp:ListItem Text="Assistan1" Value="2"></asp:ListItem>
                                    <asp:ListItem Text="Assistan2" Value="4"></asp:ListItem>
                                    <asp:ListItem Text="Write" Value="8"></asp:ListItem>
                                </asp:CheckBoxList></div>
                        <div><asp:Label ID="LblStatusEditUser" runat="server" AssociatedControlID="DdlStatusEditUser" Text="Status:" CssClass="title"></asp:Label><asp:DropDownList
                                ID="DdlStatusEditUser" runat="server" Width="20.5em">
                                <asp:ListItem Text="Valid" Value ="0"></asp:ListItem>
                                <asp:ListItem Text="Disabled" Value ="1"></asp:ListItem>
                                </asp:DropDownList></div>
                        <div style="white-space: nowrap; text-align: center; margin-top:2em;">
		                    <asp:Button ID="BtnEditUserSave" runat="server" Text="Save" OnClick="BtnEditUserSave_Click" CausesValidation="true" ValidationGroup="EditUser"/>
		                    <asp:Button ID="BtnEditUserCancel" runat="server" CausesValidation="false" Text="Cancel"/>
	                    </div>
                    </asp:Panel>
                </tbwc:Fieldset>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="RepTeam" EventName="ItemCommand" />
            </Triggers>
            </asp:UpdatePanel>
        </td>
    </tr>
</table>
